#ifdef _SYMBIAN_SDK_
#include "./symWindow.h"
#include "../inc/skyTimer.h"
#define TITLEBAR_HEIGHT 50
#define MENUBAR_HEIGHT	30

MsgStatus symWindow::handlePostEvent( myMsgMgr* mgr,Msg* message )
{
	if(message->isExactKindOf(myWinMsg::Class))
	{
		return (this->*message->getEvent())(mgr,message);
	}
	else
	{
		return invokeHandler(mgr,message);
	}
	return vContinue;
}
Rect ff(40,30,20,20);
MsgStatus	symWindow::onPaint(		myMsgMgr* mgr,Msg* msg)
{
	Painter* p = (Painter*)msg->getMessage();
	if(p->begin())
	{
		
		
		p->setBrushColor(TColor(0,0,255));
		Rect rc(0,0,240,300);
		p->fillRect(rc);
		p->setPenColor(TColor(255,0,0));
		Rect rc2(0,0,20,150);
		p->drawRect(rc2);
		p->drawPict(ff,&mTestPict);
		String::staticString s(_XT("adddddddddddddddddddddasdfdd"));
		String str(s);
		Rect r(10,20,300,80);
		p->attachFont(&mSmallFont);
		p->drawText(r,&str,TColor(0,33,44));
		p->drawRect(r);
		p->detachFont();
		p->end();
		
	}
	return vContinue;
}
MsgStatus symWindow::handleSendEvent( myMsgMgr* mgr,Msg* message  )
{
	if(message->isExactKindOf(myWinMsg::Class))
	{
		return (this->*message->getEvent())(mgr,message);
	}
	else
	{
		return invokeHandler(mgr,message);
	}
	return vContinue;
}

Void symWindow::Delete()
{
	myWinlet::Delete();
}

Bool symWindow::Create( i32 x,i32 y,i32 w,i32 h,myResMgr* resManager )
{
	
	Char* p = _XT("Sans MT 936_S60\0");
	String str(p);
	Sky::FontManager::createFont(&str,86,15,16,&mSmallFont);
	String path(_XT("c:\\System\\Apps\\sky\\test.jpg"));
	Sky::PictManager mgr;
	mgr.createPictFromFile(&path,&mTestPict,vNull);
	addHandler(toEvent(&symWindow::handleCreated),Handler::Handle(this,&symWindow::handleCreated));
	Handler::EventId e = toEvent(&myApplication::handleUISize);
	addHandler(e,Handler::Handle(this,&symWindow::handleUIEvent));
	return vTrue;
}

MsgStatus symWindow::onCreated(myMsgMgr* mgr,Msg* event)
{
	mgr->createTimer(Handler::Handle(this,&symWindow::handleTimer),10);
	return vIntercepted;
}

MsgStatus symWindow::onTimer(myMsgMgr* mgr,Msg* event )
{
    ff.x ++;
    myWinMsg msg(&myWinlet::handlePaint);
    mgr->callSystem(&msg);
	return vUnHandled;
}
#endif